﻿{% extends "gma/base.html" %}

<!-- CONTENT
  =====================================================================-->

{% block content %}

<div class="page__hd">
    <h1 class="page__title">
        <i class="fa fa-user weui_grid_icon_fa" style="font-size: 32px"> </i> {{ user.auth_nickname }}
    </h1>
    <p class="page__desc"> ID: {{ user.id }} </p>
</div>

<div class="page__bd">
    <div class="weui-cells__title">新的签名</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <textarea class="weui-textarea" id="signature" placeholder="请输入用户的新签名" rows="10"></textarea>
            </div>
        </div>
    </div>
</div>

<div class="weui-btn-area">
    <a class="weui-btn weui-btn_block weui-btn_primary" href="javascript:modify_signature()"> <i class="fa fa-edit"></i> 修改签名 </a>
</div>

<div class="page__ft">
    <a href="{% url 'gma:home' %}">
        <span class="bottom-logo">
           HiBao
       </span>
    </a>
</div>

{% endblock content %}

<!-- SCRIPT
  =====================================================================-->

{% block extra_js %}
<script>

function modify_signature() {
    const signature = $('#signature').val();

    let url = '{% url 'gma:api_modify_caster_signature' %}';
    let data = {
        'uid': {{ user.id }},
        'signature': signature,
    };
    new my_ajax(url, data, '', '', () => {
        show_toast('修改成功');
        window.location = "/gma/caster/{{ user.id }}/";
    });
}

$('#signature').val('{{ user.auth_signature|safe }}');

</script>
{% endblock extra_js %}